package cn.semes.feignclient;

import cn.semes.User;
import cn.semes.fallback.UserServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @BelongsProject: springcloudnetflix-parent
 * @BelongsPackage: cn.itsource.feignclient
 * @Author: Director
 * @CreateTime: 2022-07-28  10:27
 * @Description: 调用User服务的feign客户端
 * @Version: 1.0
 */
@FeignClient(name = "user-server", path = "user", contextId = "userService", fallbackFactory = UserServiceFallbackFactory.class) // 指定需要调用的服务的应用名称
public interface UserService {

    /*
     * @Description: OpenFeign调用user服务接口，默认底层会帮助我们创建动态代理实现类，会使用RestTemplate进行调用
     * @Author: Director
     * @Date: 2022/7/28 10:28
     * @param id:
     * @return: cn.itsource.domain.User
     **/
    @GetMapping("/{id}")
    User getUser(@PathVariable("id") Long id);

}